VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form agentinfo 
   Caption         =   "Agent Information"
   ClientHeight    =   8625
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   9795
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   10950
   ScaleWidth      =   20160
   WindowState     =   2  'Maximized
   Begin VB.ComboBox Combo2 
      Height          =   315
      Left            =   9600
      TabIndex        =   47
      Text            =   "--Select Employee Code--"
      Top             =   1440
      Width           =   2055
   End
   Begin VB.PictureBox Picture2 
      Appearance      =   0  'Flat
      ForeColor       =   &H80000008&
      Height          =   8415
      Left            =   12000
      ScaleHeight     =   8385
      ScaleWidth      =   8145
      TabIndex        =   24
      Top             =   1800
      Width           =   8175
      Begin VB.CommandButton Command3 
         Caption         =   "Senior"
         Height          =   375
         Left            =   4680
         TabIndex        =   29
         Top             =   1440
         Width           =   1455
      End
      Begin VB.CommandButton Command2 
         Caption         =   "Junior"
         Height          =   375
         Left            =   2520
         TabIndex        =   28
         Top             =   1440
         Width           =   1455
      End
      Begin VB.TextBox Text2 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   3960
         MaxLength       =   9
         TabIndex        =   27
         Top             =   240
         Width           =   2295
      End
      Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
         Height          =   6255
         Left            =   120
         TabIndex        =   25
         Top             =   1920
         Width           =   7935
         _ExtentX        =   13996
         _ExtentY        =   11033
         _Version        =   393216
         Rows            =   0
         Cols            =   5
         FixedRows       =   0
         FixedCols       =   0
         BackColorBkg    =   -2147483633
         Appearance      =   0
      End
      Begin VB.Label Label8 
         Alignment       =   2  'Center
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   5880
         TabIndex        =   31
         Top             =   840
         Width           =   1815
      End
      Begin VB.Label Label7 
         Alignment       =   2  'Center
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   30
         Top             =   840
         Width           =   4335
      End
      Begin VB.Label Label6 
         Alignment       =   2  'Center
         Caption         =   "Enter the Code Number "
         BeginProperty Font 
            Name            =   "Palatino Linotype"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1560
         TabIndex        =   26
         Top             =   240
         Width           =   2175
      End
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      ForeColor       =   &H80000008&
      Height          =   8415
      Left            =   240
      ScaleHeight     =   8385
      ScaleWidth      =   11505
      TabIndex        =   20
      Top             =   1800
      Width           =   11535
      Begin VB.TextBox Text14 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   7920
         TabIndex        =   11
         Top             =   4680
         Width           =   2295
      End
      Begin VB.OptionButton Option3 
         Caption         =   "D/O"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   4320
         TabIndex        =   4
         Top             =   1320
         Width           =   735
      End
      Begin VB.OptionButton Option2 
         Caption         =   "W/O"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3480
         TabIndex        =   3
         Top             =   1320
         Width           =   855
      End
      Begin VB.OptionButton Option1 
         Caption         =   "S/O"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   2640
         TabIndex        =   2
         Top             =   1320
         Width           =   735
      End
      Begin VB.TextBox Text13 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   7920
         TabIndex        =   15
         Top             =   6360
         Width           =   2295
      End
      Begin VB.TextBox Text12 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2640
         TabIndex        =   14
         Top             =   6360
         Width           =   2295
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   375
         Left            =   7920
         TabIndex        =   17
         Top             =   7320
         Width           =   2295
         _ExtentX        =   4048
         _ExtentY        =   661
         _Version        =   393216
         Format          =   98828289
         CurrentDate     =   40075
      End
      Begin VB.CommandButton Command1 
         Appearance      =   0  'Flat
         Caption         =   "Save"
         Height          =   375
         Left            =   10200
         TabIndex        =   18
         Top             =   7920
         Width           =   1095
      End
      Begin RichTextLib.RichTextBox RichTextBox1 
         Height          =   1455
         Left            =   7920
         TabIndex        =   9
         Top             =   3000
         Width           =   3015
         _ExtentX        =   5318
         _ExtentY        =   2566
         _Version        =   393217
         Enabled         =   -1  'True
         Appearance      =   0
         TextRTF         =   $"agentinfo.frx":0000
      End
      Begin VB.TextBox Text11 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   7920
         MaxLength       =   9
         TabIndex        =   13
         Top             =   5520
         Width           =   2295
      End
      Begin VB.TextBox Text10 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2640
         TabIndex        =   10
         Top             =   4650
         Width           =   2295
      End
      Begin VB.TextBox Text9 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   7920
         TabIndex        =   1
         Top             =   480
         Width           =   2295
      End
      Begin VB.TextBox Text8 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2640
         TabIndex        =   8
         Top             =   3075
         Width           =   2295
      End
      Begin VB.TextBox Text7 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   7920
         TabIndex        =   7
         Top             =   2160
         Width           =   2295
      End
      Begin VB.TextBox Text6 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2640
         TabIndex        =   6
         Top             =   2205
         Width           =   2295
      End
      Begin VB.TextBox Text5 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   7920
         TabIndex        =   5
         Top             =   1320
         Width           =   2295
      End
      Begin VB.TextBox Text1 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2640
         TabIndex        =   0
         Top             =   480
         Width           =   2295
      End
      Begin VB.TextBox Text3 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2640
         MaxLength       =   9
         TabIndex        =   16
         Top             =   7320
         Width           =   2295
      End
      Begin VB.TextBox Text4 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2640
         MaxLength       =   9
         TabIndex        =   12
         Top             =   5520
         Width           =   2295
      End
      Begin VB.ComboBox Combo1 
         Appearance      =   0  'Flat
         Height          =   315
         Left            =   7920
         TabIndex        =   19
         Top             =   4680
         Width           =   1815
      End
      Begin VB.Label Label20 
         Caption         =   "Relation"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   360
         TabIndex        =   45
         Top             =   1320
         Width           =   1215
      End
      Begin VB.Label Label19 
         Caption         =   "TDS"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5520
         TabIndex        =   44
         Top             =   6480
         Width           =   1455
      End
      Begin VB.Label Label18 
         Caption         =   "PAN Card Number"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   330
         TabIndex        =   43
         Top             =   6480
         Width           =   2055
      End
      Begin VB.Label Label17 
         Caption         =   "Date Of Join"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5520
         TabIndex        =   42
         Top             =   7440
         Width           =   1695
      End
      Begin VB.Label Label4 
         Caption         =   "Position"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5520
         TabIndex        =   41
         Top             =   4680
         Width           =   1575
      End
      Begin VB.Label Label9 
         Caption         =   "Father's/Husband's Name"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   5520
         TabIndex        =   40
         Top             =   1200
         Width           =   2055
      End
      Begin VB.Label Label10 
         Caption         =   "Age"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5520
         TabIndex        =   39
         Top             =   480
         Width           =   1575
      End
      Begin VB.Label Label15 
         Caption         =   "Nominee Age"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5520
         TabIndex        =   38
         Top             =   2280
         Width           =   1575
      End
      Begin VB.Label Label16 
         Caption         =   "Unit"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5520
         TabIndex        =   37
         Top             =   5520
         Width           =   1815
      End
      Begin VB.Label Label14 
         Caption         =   "Nominee Relationship"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   330
         TabIndex        =   36
         Top             =   2955
         Width           =   1575
      End
      Begin VB.Label Label13 
         Caption         =   "Nominee's Name"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   330
         TabIndex        =   35
         Top             =   2205
         Width           =   1575
      End
      Begin VB.Label Label12 
         Caption         =   "Contact No."
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   330
         TabIndex        =   34
         Top             =   4650
         Width           =   1575
      End
      Begin VB.Label Label11 
         Caption         =   "Address"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   5640
         TabIndex        =   33
         Top             =   3000
         Width           =   1575
      End
      Begin VB.Label Label1 
         Caption         =   "Name"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   330
         TabIndex        =   23
         Top             =   480
         Width           =   1575
      End
      Begin VB.Label Label2 
         Caption         =   "Code No."
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   330
         TabIndex        =   22
         Top             =   7350
         Width           =   1575
      End
      Begin VB.Label Label3 
         Caption         =   "Introducer"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   330
         TabIndex        =   21
         Top             =   5520
         Width           =   1575
      End
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   9840
      Top             =   2880
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Image Image1 
      Height          =   840
      Left            =   6960
      Picture         =   "agentinfo.frx":0082
      Stretch         =   -1  'True
      Top             =   0
      Width           =   960
   End
   Begin VB.Label Label24 
      Caption         =   "JEEVAN VAISYA GREEN AGROTECH LLP"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   7920
      TabIndex        =   50
      Top             =   240
      Width           =   5895
   End
   Begin VB.Label Label22 
      Caption         =   "EMPLOYEES' PERSONAL DETAILS"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   9360
      TabIndex        =   49
      Top             =   720
      Width           =   3015
   End
   Begin VB.Label Label23 
      Caption         =   "Downline Infromation"
      BeginProperty Font 
         Name            =   "Palatino Linotype"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   12000
      TabIndex        =   48
      Top             =   1440
      Width           =   2655
   End
   Begin VB.Label Label21 
      Caption         =   "Select Employee Code"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   6960
      TabIndex        =   46
      Top             =   1440
      Width           =   2415
   End
   Begin VB.Label Label5 
      Alignment       =   2  'Center
      Caption         =   "Employees' Personal Information"
      BeginProperty Font 
         Name            =   "Palatino Linotype"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   32
      Top             =   1440
      Width           =   3735
   End
End
Attribute VB_Name = "agentinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim c As Connection
Dim rs As Recordset
Dim rs1, rs2 As Recordset
Dim st As String

Private Sub Combo1_GotFocus()
Combo1.AddItem "Agent"
Combo1.AddItem "DM"
Combo1.AddItem "ADM"
Combo1.AddItem "RDM"
Combo1.AddItem "DA"
Combo1.AddItem "DA-I"
Combo1.AddItem "DA-II"
Combo1.AddItem "DA-III"
Combo1.AddItem "CED"
End Sub
Private Sub Combo2_Click()
Combo2.Clear
Set rs = New Recordset
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseServer
rs.CursorType = adOpenKeyset
rs.Open "select * from AgentInfo", c
rs.MoveFirst
While Not rs.EOF
If Combo2 = rs!CodeNo Then
Text1 = rs.Fields(0)
Text14 = rs.Fields(1)
Text3 = rs.Fields(2)
Text4 = rs.Fields(3)
Text11 = rs.Fields(5)
DTPicker1.Value = rs.Fields(6)
Text9 = rs.Fields(7)
Text5 = rs.Fields(8)
Text6 = rs.Fields(9)
Text8 = rs.Fields(10)
Text7 = rs.Fields(11)
If rs.Fields(12) = "S/O" Then
Option1.Value = True
ElseIf rs.Fields(12) = "W/O" Then
Option2.Value = True
Else
Option3.Value = True
End If
Text12 = rs.Fields(13)
Text13 = rs.Fields(14)
RichTextBox1.Text = rs.Fields(15)
Text10 = rs.Fields(16)
End If
rs.MoveNext
Wend
rs.Close
Combo2.Enabled = False
End Sub

Private Sub Combo2_DropDown()
Call database
Set rs = New Recordset
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseServer
rs.CursorType = adOpenKeyset
rs.Open "select CodeNo from AgentInfo", c
If Not rs.BOF Then
rs.MoveFirst
While Not rs.EOF
Combo2.AddItem (rs.Fields(0))
rs.MoveNext
Wend
End If
rs.Close
End Sub

Private Sub Combo2_GotFocus()
Call database
Set rs = New Recordset
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseServer
rs.CursorType = adOpenKeyset
rs.Open "select CodeNo from AgentInfo", c
If Not rs.BOF Then
rs.MoveFirst
While Not rs.EOF
Combo2.AddItem (rs.Fields(0))
rs.MoveNext
Wend
End If
rs.Close
End Sub
Private Sub Command1_Click()
If Text1.Text <> "" And Switch(Combo1.Visible = True, Combo1.Text, 1, Text14.Text) <> "" And Text3.Text <> "" And Text4.Text <> "" And Text5.Text <> "" And Text6.Text <> "" And Text7.Text <> "" And Text8.Text <> "" And Text9.Text <> "" And Text10.Text <> "" And Text11.Text <> "" And Text13.Text <> "" And RichTextBox1.Text <> "" Then
Call database2
rs.Fields(1) = Switch(Combo1.Visible = True, Combo1.Text, 1, Text14.Text)
rs.Fields(0) = Text1
rs.Fields(3) = Switch(Combo1.Text = "CED", "CED", Text4, Text4)
rs.Fields(5) = Text11
rs.Fields(6) = DTPicker1.Value
rs.Fields(7) = Text9
rs.Fields(8) = Text5
rs.Fields(9) = Text6
rs.Fields(10) = Text8
rs.Fields(11) = Text7
rs.Fields(12) = Switch(Option1, Option1.Caption, Option2, Option2.Caption, Option3, Option3.Caption)
rs.Fields(13) = Text12
rs.Fields(14) = Text13
rs.Fields(15) = RichTextBox1.Text
rs.Fields(16) = Text10
rs2.Fields(0) = Text1
rs2.Fields(1) = Switch(Combo1.Visible = True, Combo1.Text, 1, Text14.Text)
rs2.Fields(3) = Text4
rs.Update
rs2.Update
MsgBox "Record Updated"
Call resettxt
Else
MsgBox "Enter All Fields"
End If
End Sub

Private Sub Command2_Click()
If Text2 <> "" Then
MSFlexGrid1.Clear
Call junior
End If
End Sub

Private Sub Command3_Click()
If Text2 <> "" Then
MSFlexGrid1.Clear
Call senior(Text2)
End If
End Sub

Private Sub Form_Load()
Set c = New Connection
c.Provider = "Microsoft.Jet.OLEDB.4.0"
c.Open App.Path & "\Jeevan.mdb"
Command1.Enabled = False
DTPicker1.Value = Now
Call resettxt
End Sub
Public Sub resettxt()
Text1 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Text10 = ""
Text11 = ""
Text12 = ""
Text13 = ""
Text14 = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
RichTextBox1.Text = ""
DTPicker1.Value = Now
Command1.Enabled = False
Combo1.Clear
End Sub
Private Sub database()
Set rs = New Recordset
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseServer
rs.CursorType = adOpenKeyset
End Sub
Private Sub database1()
Set rs1 = New Recordset
rs1.LockType = adLockOptimistic
rs1.CursorLocation = adUseServer
rs1.CursorType = adOpenKeyset
End Sub
Private Sub junior()
Dim s(1000) As String
Dim i, j, l As Integer
Call database
rs.Open "select CodeNo from AgentInfo where IntroNo='" & Text2 & "' and Pos<>'CED' and Pos<>'LEFT'", c
Do
If j = 0 Then
While Not rs.EOF
s(l) = rs.Fields(0)
l = l + 1
j = l
rs.MoveNext
Wend
End If
Call database1
rs1.Open "select CodeNo from AgentInfo where IntroNO='" & s(i) & "' and Pos<>'CED' and Pos<>'LEFT'", c
While Not rs1.EOF
s(j) = rs1.Fields(0)
j = j + 1
rs1.MoveNext
Wend
i = i + 1
Loop While i < j
Call database
rs.Open "select * from AgentInfo where CodeNo='" & Text2 & "'", c
Label7.Caption = "Name :    " & rs.Fields(0)
Label8.Caption = "Position: " & rs.Fields(1)
MSFlexGrid1.Clear
MSFlexGrid1.Rows = 1
MSFlexGrid1.Cols = 6
MSFlexGrid1.ColWidth(0) = 600
MSFlexGrid1.ColWidth(1) = 2300
MSFlexGrid1.ColWidth(2) = 800
MSFlexGrid1.ColWidth(3) = 1500
MSFlexGrid1.ColWidth(4) = 1500
MSFlexGrid1.ColWidth(5) = 1350
MSFlexGrid1.ColAlignment(1) = 1
MSFlexGrid1.ColAlignment(3) = 1
MSFlexGrid1.TextMatrix(0, 0) = "S.NO"
MSFlexGrid1.TextMatrix(0, 1) = "AgentName"
MSFlexGrid1.TextMatrix(0, 2) = "Position"
MSFlexGrid1.TextMatrix(0, 3) = "CodeNo"
MSFlexGrid1.TextMatrix(0, 4) = "Intoducer"
MSFlexGrid1.TextMatrix(0, 5) = "Performance"
MSFlexGrid1.Rows = j + 1
'MSFlexGrid1.FixedRows = 1
For i = 0 To j - 1
Call database
rs.Open "select * from AgentInfo where CodeNo='" & s(i) & "'", c
MSFlexGrid1.TextMatrix(i + 1, 0) = i + 1
MSFlexGrid1.TextMatrix(i + 1, 1) = rs.Fields(0)
MSFlexGrid1.TextMatrix(i + 1, 2) = rs.Fields(1)
MSFlexGrid1.TextMatrix(i + 1, 3) = s(i)
MSFlexGrid1.TextMatrix(i + 1, 4) = rs.Fields(3)
MSFlexGrid1.TextMatrix(i + 1, 5) = Switch(IsNull(rs.Fields(4)), 0, rs.Fields(4) <= 0, 0, rs.Fields(4) > 0, rs.Fields(4))
Next i
End Sub
Private Sub senior(st As String)
Dim s(1000), t(1000) As String
Dim i, j, l As Integer
Call database
rs.Open "select IntroNo, Pos from AgentInfo where CodeNo='" & st & "' and Pos<>'CED' and Pos<>'LEFT'", c
If rs.Fields(1) <> "CED" Then
Do
If j = 0 Then
While Not rs.EOF
s(l) = rs.Fields(0)
t(l) = rs.Fields(1)
l = l + 1
j = l
rs.MoveNext
Wend
End If
Call database1
rs1.Open "select IntroNo from AgentInfo where CodeNo='" & s(i) & "' and Pos<>'CED' and Pos<>'LEFT'", c
While Not rs1.EOF
s(j) = rs1.Fields(0)
j = j + 1
rs1.MoveNext
Wend
i = i + 1
Loop While i < j
End If
Call database
rs.Open "select * from AgentInfo where CodeNo='" & st & "'", c
Label7.Caption = "Name :    " & rs.Fields(0)
Label8.Caption = "Position: " & rs.Fields(1)
MSFlexGrid1.Clear
MSFlexGrid1.Rows = 1
MSFlexGrid1.Cols = 6
MSFlexGrid1.ColWidth(0) = 600
MSFlexGrid1.ColWidth(1) = 1600
MSFlexGrid1.ColWidth(2) = 1500
MSFlexGrid1.ColWidth(3) = 1500
MSFlexGrid1.ColWidth(4) = 1500
MSFlexGrid1.ColWidth(5) = 1432
MSFlexGrid1.ColAlignment(1) = 1
MSFlexGrid1.ColAlignment(3) = 1
MSFlexGrid1.TextMatrix(0, 0) = "S.NO"
MSFlexGrid1.TextMatrix(0, 1) = "AgentName"
MSFlexGrid1.TextMatrix(0, 2) = "Position"
MSFlexGrid1.TextMatrix(0, 3) = "CodeNo"
MSFlexGrid1.TextMatrix(0, 4) = "Intoducer"
MSFlexGrid1.TextMatrix(0, 5) = "Performance"
MSFlexGrid1.Rows = j + 1
For i = 0 To j - 1
If t(i) <> "CED" And t(i) <> "LEFT" Then
Call database
rs.Open "select * from AgentInfo where CodeNo='" & s(i) & "'", c
MSFlexGrid1.TextMatrix(i + 1, 0) = i + 1
MSFlexGrid1.TextMatrix(i + 1, 1) = rs.Fields(0)
MSFlexGrid1.TextMatrix(i + 1, 2) = rs.Fields(1)
MSFlexGrid1.TextMatrix(i + 1, 3) = s(i)
MSFlexGrid1.TextMatrix(i + 1, 4) = rs.Fields(3)
MSFlexGrid1.TextMatrix(i + 1, 5) = Switch(rs.Fields(4) = 0, 0, rs.Fields(4), rs.Fields(4))
End If
Next i
End Sub

Private Sub Text11_LostFocus()
Dim a As Boolean
If Text11 <> "" Then
a = emp(Text11)
If a = True Then
MsgBox "Invalid Code No."
Text11 = ""
Text11.SetFocus
End If
End If
End Sub
Private Sub Text2_LostFocus()
Dim a As Boolean
If Text2 <> "" Then
a = emp(Text2)
If a = True Then
MsgBox "Invalid Code No."
Text2 = ""
Text2.SetFocus
End If
End If
End Sub

Private Sub Text3_LostFocus()
If Text3 <> "" Then
If checkUser(Text3) Then
Command1.Enabled = True
Else
MsgBox "Code Number Already Exists"
Text3.Text = ""
Text3.SetFocus
End If
End If
End Sub

Private Sub Text4_LostFocus()
Dim a As Boolean
If Text4 <> "" Then
a = emp(Text4)
If a = True Then
MsgBox "Invalid Code No."
Text4 = ""
Text4.SetFocus
End If
End If
End Sub
Private Sub database2()
Set rs = New Recordset
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseServer
rs.CursorType = adOpenKeyset
Set rs2 = New Recordset
rs2.LockType = adLockOptimistic
rs2.CursorLocation = adUseServer
rs2.CursorType = adOpenKeyset
If Combo2.Visible = False Then
rs.Open "select * from AgentInfo", c
rs.AddNew
rs.Fields(2) = Text3
rs2.Open "select * from salary", c
rs2.AddNew
rs2.Fields(2) = Text3
Else
rs.Open "select * from AgentInfo where CodeNo='" & Text3 & "'", c
rs2.Open "select * from salary  where CodeNo='" & Text3 & "'", c
End If
End Sub

Private Function checkUser(userID) As Boolean
Set rs = New Recordset
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseServer
rs.CursorType = adOpenKeyset
rs.Open "Select * from AgentInfo where CodeNo='" & userID & "'", c
If rs.RecordCount = 0 Then
checkUser = True
Else
checkUser = False
End If
End Function
